<?php
/**
 * @testdbIndividual.php
 * Controls database operations on the testdbIndividual table.
 *
 * Copyright 2011 by Matthew Wakim.  This program is part of Donate.
 * Donate is free software.  It comes with absolutely no warranty.
 * You can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation
 * (see <http://www.gnu.org/licenses/ for more information).
 * 
 * @version March 5th 2011
 * @author Matthew Wakim
 */
include_once(dirname(__FILE__).'/../db-control/dbIndividuals.php');
class testdbIndividuals extends UnitTestCase {
      function testdbIndividualsModule() {
/** add a Individual
*/
$m = new Individual("1", "Matthew", "Wakim"  );
$this->assertTrue(add_Individual($m));

/** add an IndividualID, Individual Type
*/
$a = new Individual("2", "Barney", "Rubble"  );
$this->assertTrue(add_Individual($a));

/** add a IndividualID, IndividualType,
*/ 
$c = new Individual("3", "Don", "Sulvester"  );
$this->assertTrue(add_Individual($c));

/** add a sub
*/
$s = new Individual("4", "Jim","Carrey" );
$this->assertTrue(add_Individual($s));

/** add a volunteer
*/
$v = new Individual("5", "Linden", "Johnson" );
$this->assertTrue(add_Individual($v));

/** try to add a duplicate - should return false
*/
$v = new Individual("6", "Cal", "Roberts"  );
$this->assertFalse(add_Individual($v));

/** get a Individual
*/
$p = get_Individual("Matthew");
$this->assertTrue($p!==null);

/** try to get a Individual who is not in the
*/
//this->assertFalse(get_Individual("John"));

/** get a different one
*/
$p = get_Individual("Linden");
$this->assertTrue($p!==null);

/** get all volunteers available for organization
*/
$a = getall_available("2");
$this->assertTrue(count($a) == 1);

/** remove all Individuals
*/
$this->assertTrue(remove_Individual("1"));
$this->assertTrue(remove_Individual("2"));
$this->assertTrue(remove_Individual("3"));
$this->assertTrue(remove_Individual("4"));
$this->assertTrue(remove_Individual("5"));

/** try to remove a Individual who is not in the db - should not work
*/
$this->assertFalse(remove_Individual("10"));

echo("testdbIndividuals complete");
      }
}


?>
